import socket

client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect(("127.0.0.1", 8080))

while True:
    message = input("输入消息：")
    client_socket.send(message.encode("utf-8"))
    if message == "exit":
        break
    data = client_socket.recv(1024)
    decoded_data = data.decode("utf-8")
    print(f"服务器回复：{decoded_data}")

client_socket.close()
